package com.example.dockertest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@SpringBootApplication
public class DockerTestApplication {

    public static void main(String[] args) {
        SpringApplication.run(DockerTestApplication.class, args);
    }

    @GetMapping()
    public Object test(){
        return "hello";
    }

    @GetMapping("/{name}")
    public Object testGet(@PathVariable String name){
        Map<String, Object> map = new HashMap<>(1);
        map.put("name", name);
        return map;

    }

    @PostMapping("")
    public Object testPost(String name){
        Map<String, Object> map = new HashMap<>(1);
        map.put("post-name", name);
        return map;
    }
}
